<template>
  <div class="_wz_emergencyRecordDetails">
    <table cellpadding="0" cellspacing="0" border="0">
      <colgroup>
        <col width="13%" />
        <col width="20%" />
        <col width="13%" />
        <col width="20%" />
        <col width="13%" />
        <col width="20%" />
      </colgroup>
      <tbody>
      <tr>
        <td style="font-weight: 600;position:relative;" colspan="6">信息</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">经营企业</td>
        <td colspan="2" style="border-top: 0px;">{{ formData.deptName ? formData.deptName : "--" }}</td>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">预案名称</td>
        <td colspan="2" style="border-top: 0px;">{{formData.emergencyDrillPlanName ? formData.emergencyDrillPlanName : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">演练地点</td>
        <td colspan="2">{{formData.emergencyDrillPlace ? formData.emergencyDrillPlace : "--" }}</td>

        <td style="text-align: right;font-weight: 600;border-top: 0px;">组织部门</td>
        <td colspan="2" style="border-top: 0px;">{{formData.emergencyDrillOrganizeDepartments ? formData.emergencyDrillOrganizeDepartments : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">总指挥</td>
        <td colspan="2">{{formData.emergencyDrillCommander ? formData.emergencyDrillCommander : "--" }}</td>
        <td style="text-align: right;font-weight: 600;">演练时间</td>
        <td colspan="2">{{formData.emergencyDrillDate ? formData.emergencyDrillDate : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">参加部门</td>
        <td colspan="5" style="border-top: 0px;">{{formData.emergencyDrillJoinDepartments ? formData.emergencyDrillJoinDepartments : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">参加人员</td>
        <td colspan="5">{{formData.emergencyDrillJoinPersons ? formData.emergencyDrillJoinPersons : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">演练部分</td>
        <td colspan="5" style="border-top: 0px;">{{formData.emergencyDrillRealityPart ? formData.emergencyDrillRealityPart : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">物资和培训</td>
        <td colspan="5">{{formData.emergencyDrillMaterialTrain ? formData.emergencyDrillMaterialTrain : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">演练描述</td>
        <td colspan="5" style="border-top: 0px;">{{formData.emergencyDrillProcessDesc ? formData.emergencyDrillProcessDesc : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">演练类别</td>
        <td colspan="2" style="border-top: 0px;">{{formData.emergencyDrillClass ? formData.emergencyDrillClass : "--" }}</td>
        <td style="text-align: right;font-weight: 600;">演练方式</td>
        <td colspan="2">{{ formData.emergencyDrillWay ? formData.emergencyDrillWay : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">适宜性</td>
        <td colspan="2">{{formData.emergencyDrillSuitability ? formData.emergencyDrillSuitability : "--" }}</td>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">充分性</td>
        <td colspan="2" style="border-top: 0px;">{{formData.emergencyDrillAdequacy ? formData.emergencyDrillAdequacy : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">人员到位</td>
        <td colspan="2">{{formData.emergencyDrillPersonnelAvailability ? formData.emergencyDrillPersonnelAvailability : "--" }}</td>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">人员职责</td>
        <td colspan="2" style="border-top: 0px;">{{formData.emergencyDrillPersonnelDuty ? formData.emergencyDrillPersonnelDuty : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">物资到位</td>
        <td colspan="2">{{formData.emergencyDrillMaterialAvailability ? formData.emergencyDrillMaterialAvailability : "--" }}</td>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">个人防护</td>
        <td colspan="2" style="border-top: 0px;">{{formData.emergencyDrillProtectionAvailability ? formData.emergencyDrillProtectionAvailability : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">整体组织</td>
        <td colspan="2">{{formData.emergencyDrillOverallCoordinating ? formData.emergencyDrillOverallCoordinating : "--"}}</td>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">抢险组分</td>
        <td colspan="2" style="border-top: 0px;">{{formData.emergencyDrillEmergencyCoordinating ? formData.emergencyDrillEmergencyCoordinating : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">效果评价</td>
        <td colspan="2">{{formData.emergencyDrillActualEvaluation ? formData.emergencyDrillActualEvaluation : "--" }}</td>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">
          报告上级
        </td>
        <td colspan="2" style="border-top: 0px;">{{formData.emergencyDrillReportSuperior ? formData.emergencyDrillReportSuperior : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">消防部门</td>
        <td colspan="1">{{formData.emergencyDrillReportFireDepartment ? formData.emergencyDrillReportFireDepartment : "--"}}</td>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">
          医疗部门
        </td>
        <td colspan="1" style="border-top: 0px;">{{formData.emergencyDrillReportMedicalDepartment ? formData.emergencyDrillReportMedicalDepartment : "--"}}</td>
        <td style="text-align: right;font-weight: 600;">政府部门</td>
        <td colspan="1">{{formData.emergencyDrillReportGovernmentDepartment ? formData.emergencyDrillReportGovernmentDepartment : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">存在问题</td>
        <td colspan="5" style="border-top: 0px;">{{formData.emergencyDrillQuestion ? formData.emergencyDrillQuestion : "--" }}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;">改进措施</td>
        <td colspan="5">{{formData.emergencyDrillImprovement ? formData.emergencyDrillImprovement : "--"}}</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">记录编制人</td>
        <td colspan="2" style="border-top: 0px;">{{formData.emergencyDrillRecordCompiler ? formData.emergencyDrillRecordCompiler : "--"}}</td>
        <td rowspan="1" style="text-align: right;font-weight: 600;">记录批准人</td>
        <td colspan="2">{{formData.emergencyDrillRecordCertifier ? formData.emergencyDrillRecordCertifier : "--" }}</td>
      </tr>
      <tr>
        <td colspan="6" style="text-align: left;border-top: 0px;">演练图片</td>
      </tr>
      <tr>
        <td colspan="6">
          <div style="display: flex;flex-wrap: wrap;">
            <div class="demo-upload-list" v-for="(item, index) in imgList">
                <Image :src="!!item ? apiUrl.imgUrl + item:'img/zwtpxd.png'" fit="contain" width=100% height=100% preview :preview-list="[!!item ? apiUrl.imgUrl + item:'img/zwtpxd.png']" />
            </div>
          </div>
        </td>
      </tr>
      <tr>
        <td colspan="6" style="text-align: left;border-top: 0px;">评审记录</td>
      </tr>
      <tr>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">评审记录人</td>
        <td colspan="1" style="border-top: 0px;">{{formData.emergencyDrillExamineRecorder ? formData.emergencyDrillExamineRecorder : "--" }}</td>
        <td rowspan="1" style="text-align: right;font-weight: 600;">评审负责人</td>
        <td colspan="1">{{formData.emergencyDrillExamineLeader ? formData.emergencyDrillExamineLeader : "--" }}</td>
        <td style="text-align: right;font-weight: 600;border-top: 0px;">评审日期</td>
        <td colspan="1" style="border-top: 0px;">{{formData.emergencyDrillExamineDate ? formData.emergencyDrillExamineDate : "--" }}</td>
      </tr>
      <tr>
        <td rowspan="1" style="text-align: right;font-weight: 600;">评审结论</td>
        <td colspan="5">{{formData.emergencyDrillExamineConclusion ? formData.emergencyDrillExamineConclusion : "--" }}</td>
      </tr>
      </tbody>
    </table>

  </div>
</template>
<script>


import {
  getCurrentInstance,
  inject,
  nextTick,
  reactive,
  toRefs,
  toRef,
  onBeforeMount,
  onMounted,
  onBeforeUpdate,
  onUpdated,
  onBeforeUnmount,
  onUnmounted,
  ref,
  defineComponent,
  toRaw,
  watch,
  resolveComponent
} from 'vue'
import { useRouter,useRoute } from "vue-router";

import { useMainStore } from '../../../store'  //pinia 使用 类似 vuex
import { storeToRefs } from 'pinia'//pinia 使用 类似 vuex
const mainStore = useMainStore() //pinia 使用 类似 vuex

import wzTbale from "../../../components/table/index.vue";
//reactive
export default defineComponent({
  name: 'emergencyRecordDetails',//组件名称
  components: {
    wzTbale,
  },//组件引用
  props: ['selectData'],//接收来自父组件的数据
  setup (props,context) {


    const apiUrl = inject('$apiUrl'); // 变量全局化 后台地址
    const $axios = inject('$axiosInterceptor');// 变量全局化 axios
    const $ViewUIPlus = inject('$ViewUIPlus');//引用全局组件
    const router = useRouter();//路由跳转使用


    const state = reactive({
      formData: {},//培训数据
      imgList: [],//


    });

    //加载数据
    const loadData = ()=>{
      $axios.post(apiUrl.safetyEmergencyEmergencyDrillRecordInfo,{uuid:props.selectData.uuid}).then((res) => {
        if(!!res.data){
          state.formData = res.data.data;
          state.imgList = state.formData.emergencyDrillImgs.split(",");
        }

      }).catch((err) => {
        console.log("失败", err)
      })

    }



    // 其他的生命周期
    onBeforeMount (() => {//beforeMount挂载前状态 // console.log("App ===> 相当于 vue2.x 中 beforeMount")

    })
    onMounted (() => {//mounted 挂载结束状态  // console.log("App ===> 相当于 vue2.x 中 mounted")
      state.formData = props.selectData
      loadData()
    })

    // 注意，onBeforeUpdate 和 onUpdated 里面不要修改值
    onBeforeUpdate (() => {//beforeUpdate 更新前状态 // console.log("App ===> 相当于 vue2.x 中 beforeUpdate")

    })

    onUpdated (() => {//updated 更新完成状态 // console.log("App ===> 相当于 vue2.x 中 updated")

    })

    onBeforeUnmount (() => {//beforeDestroy 销毁前状态  // console.log("App ===> 相当于 vue2.x 中 beforeDestroy")
    })

    onUnmounted (() => {//destroyed 销毁完成状态  // console.log("App ===> 相当于 vue2.x 中 destroyed")
    })

    return {
      ...toRefs(state),
      apiUrl,
    }
  }
})


</script>
<style lang="less">

._wz_emergencyRecordDetails {
  padding: 10px;
  height: 100%;
  display: flex;
  flex-direction: column;

  table {
    table-layout: fixed;
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 12px !important;

    td {
      min-width: 0;
      height: 40px;
      box-sizing: border-box;
      text-align: left;
      text-overflow: ellipsis;
      border: 1px solid #515a6e;
      padding: 0 10px;
      word-break: break-word;
    }

    .demo-upload-list {
      margin: 5px auto;
      width: 200px;
      height: 140px;
      text-align: center;
      border-radius: 4px;
      overflow: hidden;
      background: #fff;
      position: relative;

      img {
        min-height: 30%;
        max-height: 90%;
        min-width: 30%;
        max-width: 90%;
        //width: 100%;
        //height: 100%;
      }
    }
  }
}
</style>
